package com.zjsd.sqeybusiness.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.zjsd.sqeybusiness.domain.Orderappeal;
import com.zjsd.sqeybusiness.service.IOrderappealService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 订单申诉信息Controller
 *
 * @author Zheng
 * @date 2025-03-11
 */
@RestController
@RequestMapping("/sqeybusiness/orderappeal")
public class OrderappealController extends BaseController
{
    @Autowired
    private IOrderappealService orderappealService;

    /**
     * 查询订单申诉信息列表
     */
    @PreAuthorize("@ss.hasPermi('sqeybusiness:orderappeal:list')")
    @GetMapping("/list")
    public TableDataInfo list(Orderappeal orderappeal)
    {
        startPage();
        List<Orderappeal> list = orderappealService.selectOrderappealList(orderappeal);
        return getDataTable(list);
    }

    /**
     * 导出订单申诉信息列表
     */
    @PreAuthorize("@ss.hasPermi('sqeybusiness:orderappeal:export')")
    //@Log(title = "订单申诉信息", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(Orderappeal orderappeal)
    {
        List<Orderappeal> list = orderappealService.selectOrderappealList(orderappeal);
        ExcelUtil<Orderappeal> util = new ExcelUtil<Orderappeal>(Orderappeal.class);
        return util.exportExcel(list, "orderappeal");
    }

    /**
     * 获取订单申诉信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('sqeybusiness:orderappeal:query')")
    @GetMapping(value = "/{appealid}")
    public AjaxResult getInfo(@PathVariable("appealid") Long appealid)
    {
        return AjaxResult.success(orderappealService.selectOrderappealById(appealid));
    }

    /**
     * 新增订单申诉信息
     */
    @PreAuthorize("@ss.hasPermi('sqeybusiness:orderappeal:add')")
    //@Log(title = "订单申诉信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Orderappeal orderappeal)
    {
        return toAjax(orderappealService.insertOrderappeal(orderappeal));
    }

    /**
     * 修改订单申诉信息
     */
    @PreAuthorize("@ss.hasPermi('sqeybusiness:orderappeal:edit')")
    //@Log(title = "订单申诉信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Orderappeal orderappeal)
    {
        return toAjax(orderappealService.updateOrderappeal(orderappeal));
    }

    /**
     * 删除订单申诉信息
     */
    @PreAuthorize("@ss.hasPermi('sqeybusiness:orderappeal:remove')")
    //@Log(title = "订单申诉信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{appealids}")
    public AjaxResult remove(@PathVariable Long[] appealids)
    {
        return toAjax(orderappealService.deleteOrderappealByIds(appealids));
    }
}
